const { $wx, $http } = getApp()
Page({
    data: {
        formData: [
            { label:'昵称', name:'nickname', r:1 },
            { label:'手机', name:'phone', r:1 },
            // { label:'年龄', name:'age' },
            // { label:'单选', name:'radio', type:'radio', value: 1, t:'bool', data:sex },
        ],
    },
    async onSubmit({ detail }){
        let user = $wx.getUser()
        await $http.post(this,'user/register', { 
            param:{ id:user.id, ...detail },
            onOk: data => {
                $wx.local('user', { ...user, ...data })
                $wx.msg.ok('提交成功')
            },
            okText: '提交成功',
            back: true
        })
    }
})